/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.handlers.commands.call;

import com.hercules.android.receiver.AndroidReceiver;

import java.io.Serializable;

/**
 * This interface defines the contract for implementations that will encrypt and decrypt an object.
 * <p>
 * <b>Thread Safety:</b> Implementations are required to be thread safe after initialization has taken place.
 *
 * @author DanLazar, orial
 * @version 1.0
 */
public interface ObjectEncryptor {
    /**
     * Encrypts the given object.
     *
     * @param object the object to be encrypted
     * @param receiver the current android receiver
     * @return the encrypted object as an array of bytes
     * @throws IllegalArgumentException if any parameter is null or receiver is incorrect
     * @throws ObjectEncryptorException if any errors occur while encrypting the object
     */
    byte[] encrypt(Serializable object, AndroidReceiver receiver) throws ObjectEncryptorException;

    /**
     * Decrypts the given object.
     *
     * @param object the object, as an array of bytes, to be decrypted
     * @param receiver the current android receiver
     * @return the decrypted object
     * @throws IllegalArgumentException if object is null or empty or receiver is incorrect
     * @throws ObjectEncryptorException if any errors occur while decrypting the object
     */
    Serializable decrypt(byte[] object, AndroidReceiver receiver) throws ObjectEncryptorException;
}